public class Signal {

	protected String execute;
	protected int x ;
	protected int y ;
	
	public Signal( ){

	}



	public void receive(String execute){
		//Map m	= new Map( );
		//setX(m.x);
		//setY(m.y);

		if (execute.length( )==0) {
			return ;
			
		}


		if (execute.length( )==1) {
			if ("W".equals(execute)) {
				System.out.println("前进");
				y++;
			}
			if ("S".equals(execute)) {
				System.out.println("后退");
				y--;
			}
			if ("D".equals(execute)) {
				System.out.println("向右");
				x++;
			}
			if ("A".equals(execute)) {
				System.out.println("向左");
				x--;	
			}
		}			
					
		if(execute.length( ) >1){
			String  execute1[ ]= execute.split(","); 
			for (int i = 0; i < execute1.length; i++){
				receive(execute1[i] );
			}

		}
	}


	
	public void sendToMap(int x ,int y ){
		
		if (Math.abs(x)>3) {
		System.out.println("超出控制范围");
			return;
			
		}
		if (Math.abs(y)>3) {
		System.out.println("超出控制范围");
			return;
		}
		
		else{		
		System.out.println("结束位置为"+x+","+y);	
		}
	}



//=======================================
	public void setExecute(String execute ){
		this.execute =execute ;
	}

	public String getExecute( ){
		return execute ;
	}

	public void setX( int x){
		this.x= x;
	}

	public int getX( ){
		return x;
	}

	public void setY( int y ){
		this.y=y;
	}

	public int getY( ){
		return y;
	}



}